
// source idl: idl.GisErpDao.java

#ifndef GISERPDAO_STUB_4_APP_H
#define GISERPDAO_STUB_4_APP_H

#include <string>
#include <sstream>
#include "app_platform/cmd_obj.h"
#include "c2cent/base/basestub4app.h"
#include "app_platform/cntl_info.h"
#include "app_platform/intf_serializable.h"
#include "app_platform/intf_service_object.h"
#include "erp/gis/ddo/shiptypearealocusdo_gis.h"	
#include <vector>	
#include "erp/gis/ddo/shiptypearealocusdolist_gis.h"	
#include "intf_giserpdao.h"

namespace erp
{
namespace gis
{
namespace dao
{
	#define GISERPDAO_STUB4APP_VERSION "ERP_GIS_DAO___GISERPDAO__STUB4APP_VERSION__1.0 "__DATE__" "__TIME__
    const std::string GISERPDAO_STUB4APP_NOUSE = GISERPDAO_STUB4APP_VERSION;

	const uint32_t GISERPDAO_GETMAPCOVERLOCUSLIST_REQ_CMD_ID = 0xc0241001; ///获取覆盖轨迹列表请求类  请求命令号
	const uint32_t GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID = 0xc0248001; ///获取覆盖轨迹列表返回类  回应命令号
	

	const uint32_t GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_REQ_CMD_ID = 0xc0241002; ///同步配送区域轨迹记录请求类  请求命令号
	const uint32_t GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID = 0xc0248002; ///同步配送区域轨迹记录返回类  回应命令号
	


	const uint16_t GISERPDAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号

///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 获取覆盖轨迹列表请求类 
	 *
	 *
 	 * @date 2013-10-20 15:24:25
 	 * @version 0
	 */	
	struct CGetMapCoverLocusListReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t shipType;
		uint32_t destGbId;
		std::string inReserve;
		erp::gis::ddo::CShipTypeAreaLocusDoList shipTypeAreaLocusDoList;
		std::string errMsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return GISERPDAO_GETMAPCOVERLOCUSLIST_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > GISERPDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & shipType;
			bs & destGbId;
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 获取覆盖轨迹列表返回类 
	 *
 	 * @date 2013-10-20 15:24:25
 	 * @version 0
	 */	
	struct CGetMapCoverLocusListResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		erp::gis::ddo::CShipTypeAreaLocusDoList shipTypeAreaLocusDoList;
		std::string errMsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			shipTypeAreaLocusDoList.Serialize(bs);
			bs & errMsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 同步配送区域轨迹记录请求类 
	 *
	 *
 	 * @date 2013-10-20 15:24:25
 	 * @version 0
	 */	
	struct CShipTypeAreaLocusRowSyncReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		erp::gis::ddo::CShipTypeAreaLocusDo shipTypeAreaLocusDo;
		std::string inReserve;
		std::string errMsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > GISERPDAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			shipTypeAreaLocusDo.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 同步配送区域轨迹记录返回类 
	 *
 	 * @date 2013-10-20 15:24:25
 	 * @version 0
	 */	
	struct CShipTypeAreaLocusRowSyncResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errMsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errMsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	class CGisErpDaoStub4App : public c2cent::CBaseStub4App, public IGisErpDao,public IGisErpDaoAsyc{
		public:
			uint32_t GetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t shipType,
				uint32_t destGbId,
				const std::string& inReserve,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
			);
			
			uint32_t SendGetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t shipType,
				uint32_t destGbId,
				const std::string& inReserve
		    );
		    uint32_t RecvGetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
		    );
		    
		    uint32_t RecvGetMapCoverLocusList(
		  		CCmdObj& rCmd,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
		    );
		    
		    uint32_t GetGetMapCoverLocusListRespCmd(
		    );
			uint32_t ShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::gis::ddo::CShipTypeAreaLocusDo& shipTypeAreaLocusDo,
				const std::string& inReserve,
				std::string& errMsg,
				std::string& outReserve
			);
			
			uint32_t SendShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::gis::ddo::CShipTypeAreaLocusDo& shipTypeAreaLocusDo,
				const std::string& inReserve
		    );
		    uint32_t RecvShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				std::string& errMsg,
				std::string& outReserve
		    );
		    
		    uint32_t RecvShipTypeAreaLocusRowSync(
		  		CCmdObj& rCmd,
				std::string& errMsg,
				std::string& outReserve
		    );
		    
		    uint32_t GetShipTypeAreaLocusRowSyncRespCmd(
		    );
	};
	
	/**
	 *
 	 * 获取覆盖轨迹列表 
	 *
		 *@param String machineKey: 机器码，必填，对应网站cookie中的visitkey，若无则填随机值 				
		 *@param String source: 调用来源文件名称，必填 				
		 *@param uint32_t sceneId: 场景id，必填（目前填0即可） 				
		 *@param uint32_t shipType: 配送方式 				
		 *@param uint32_t destGbId: 目标地址国标ID(目前省或者市) 				
		 *@param String inReserve: 请求保留字段 				
		 *@param ShipTypeAreaLocusDoList shipTypeAreaLocusDoList: 覆盖轨迹列表 		
		 *@param String errMsg: 错误信息 		
		 *@param String outReserve: 请求保留字段 		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CGisErpDaoStub4App::GetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t shipType,
				uint32_t destGbId,
				const std::string& inReserve,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
	)
	{
		CGetMapCoverLocusListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.shipType = shipType;
			oReq.destGbId = destGbId;
			oReq.inReserve = inReserve;
			oReq.shipTypeAreaLocusDoList = shipTypeAreaLocusDoList;
			oReq.errMsg = errMsg;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetMapCoverLocusListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			shipTypeAreaLocusDoList  = oResp.shipTypeAreaLocusDoList;
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t CGisErpDaoStub4App::SendGetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t shipType,
				uint32_t destGbId,
				const std::string& inReserve
	)
	{
	    CGetMapCoverLocusListReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.shipType = shipType;
			oReq.destGbId = destGbId;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t CGisErpDaoStub4App::RecvGetMapCoverLocusList(
				const CCntlInfo& rCntlInfo,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetMapCoverLocusListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			shipTypeAreaLocusDoList  = oResp.shipTypeAreaLocusDoList;
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t CGisErpDaoStub4App::RecvGetMapCoverLocusList(
		  		CCmdObj& rCmd,
				erp::gis::ddo::CShipTypeAreaLocusDoList& shipTypeAreaLocusDoList,
				std::string& errMsg,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetMapCoverLocusListResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			shipTypeAreaLocusDoList  = oResp.shipTypeAreaLocusDoList;
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t CGisErpDaoStub4App::GetGetMapCoverLocusListRespCmd(
	)
	{	    
	    return GISERPDAO_GETMAPCOVERLOCUSLIST_RESP_CMD_ID;
	}	
	/**
	 *
 	 * 同步配送区域轨迹记录 
	 *
		 *@param String machineKey: 机器码，必填，对应网站cookie中的visitkey，若无则填随机值 				
		 *@param String source: 调用来源文件名称，必填 				
		 *@param uint32_t sceneId: 场景id，必填（目前填0即可） 				
		 *@param ShipTypeAreaLocusDo shipTypeAreaLocusDo: 配送区域轨迹DO 				
		 *@param String inReserve: 请求保留字段 				
		 *@param String errMsg: 错误信息 		
		 *@param String outReserve: 请求保留字段 		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CGisErpDaoStub4App::ShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::gis::ddo::CShipTypeAreaLocusDo& shipTypeAreaLocusDo,
				const std::string& inReserve,
				std::string& errMsg,
				std::string& outReserve
	)
	{
		CShipTypeAreaLocusRowSyncReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.shipTypeAreaLocusDo = shipTypeAreaLocusDo;
			oReq.inReserve = inReserve;
			oReq.errMsg = errMsg;
			oReq.outReserve = outReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
	
	    if((iRetCode = m_pSvcCntl->schedule()) != 0)
	    {
	        m_sErrMsg = "schedule failed.";
	        return 0xFFF2;
	    }
	    
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
            return 0xEE0029;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CShipTypeAreaLocusRowSyncResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0030;
	    }
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	inline uint32_t CGisErpDaoStub4App::SendShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				const erp::gis::ddo::CShipTypeAreaLocusDo& shipTypeAreaLocusDo,
				const std::string& inReserve
	)
	{
	    CShipTypeAreaLocusRowSyncReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.shipTypeAreaLocusDo = shipTypeAreaLocusDo;
			oReq.inReserve = inReserve;
	
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    int iRetCode = 0;
	    if((iRetCode = m_pSvcCntl->putSvcObj(&oReq, pCntlInfo->getRouteKey())) != 0)
	    {
	    	m_sErrMsg = "DoRequest failed.";
	        return iRetCode;
	    }
		return 0;
	}
	inline uint32_t CGisErpDaoStub4App::RecvShipTypeAreaLocusRowSync(
				const CCntlInfo& rCntlInfo,
				std::string& errMsg,
				std::string& outReserve
	)
	{
		CCntlInfo* pCntlInfo = const_cast<CCntlInfo*>(&rCntlInfo);
	    m_pSvcCntl = reinterpret_cast<IServiceControl*>(pCntlInfo->getCntl());
	    CCmdObj& rCmd = m_pSvcCntl->getRespObj();
	    if(!rCmd.isValid(GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID))
	    {
	    	std::stringstream oss;
            oss << "Cmd not match: "
                << "expected cmd=" << std::hex << GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << rCmd.getCmdId() << std::dec;
            m_sErrMsg = oss.str();
	        return 0xEE0031;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CShipTypeAreaLocusRowSyncResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0032;
	    }
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t CGisErpDaoStub4App::RecvShipTypeAreaLocusRowSync(
		  		CCmdObj& rCmd,
				std::string& errMsg,
				std::string& outReserve
	)
	{	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    rCmd.getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CShipTypeAreaLocusRowSyncResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0033;
	    }
			errMsg  = oResp.errMsg;
			outReserve  = oResp.outReserve;
	    
	    return oResp.dwResult;
	}
	
	inline uint32_t CGisErpDaoStub4App::GetShipTypeAreaLocusRowSyncRespCmd(
	)
	{	    
	    return GISERPDAO_SHIPTYPEAREALOCUSROWSYNC_RESP_CMD_ID;
	}	
		
}
}
}

#endif /* GISERPDAO_STUB_4_APP_H */
